﻿<ClientManagerView:EventResourceDictionary 
    x:Class="FacebookClient.NewsFeedEventResourceDictionary"    
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:FacebookClient="clr-namespace:FacebookClient"
    xmlns:ClientManagerControls="clr-namespace:ClientManager.Controls"
    xmlns:Properties="clr-namespace:FacebookClient.Properties"
    xmlns:ClientManagerView="clr-namespace:ClientManager.View"
    xmlns:ClientManager="clr-namespace:ClientManager"
    xmlns:Facebook="clr-namespace:Contigo;assembly=Contigo">

    <!-- Home page template ("what's new") -->
    <DataTemplate DataType="{x:Type ClientManagerView:HomePage}">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>

            <FacebookClient:SearchAndFilterControl Grid.Column="0" Width="200">
                <FacebookClient:SearchAndFilterControl.Style>
                    <Style TargetType="{x:Type FacebookClient:SearchAndFilterControl}">
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type FacebookClient:MainWindow}}, Path=IsInSmallMode}" Value="True">
                                <Setter Property="Visibility" Value="Collapsed"/>
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </FacebookClient:SearchAndFilterControl.Style>
            </FacebookClient:SearchAndFilterControl>

            <ClientManagerControls:Spinner Grid.Column="1" Foreground="{DynamicResource SpinnerBrush}">
                <ClientManagerControls:Spinner.Style>
                    <Style TargetType="{x:Type ClientManagerControls:Spinner}">
                        <Setter Property="IsRunning" Value="False" />
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding Source={x:Static ClientManager:ServiceProvider.ViewManager}, Path=NewsFeed.Count}" Value="0">
                                <Setter Property="IsRunning" Value="True" />
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </ClientManagerControls:Spinner.Style>
            </ClientManagerControls:Spinner>

            <FacebookClient:ScaleScrollViewer x:Name="ScaleScrollViewer"
          Grid.Column="1"
          Style="{DynamicResource MainScaleScrollViewerStyle}"
          Scale="{Binding Source={x:Static Properties:Settings.Default}, Path=NewsFeedScale, Mode=TwoWay}" 
          MinScale="0.4"
          MaxScale="2.5" 
          MouseWheelScrollDelta="96" 
          IsAnimationEnabled="False"
          FocusOnLoad="True">
                <FacebookClient:DelayedResizeDecorator HorizontalAlignment="Left">
                    <FacebookClient:IncrementalLoadListBox x:Name="IncrementalLoadListBox" 
              ScrollViewer.VerticalScrollBarVisibility="Disabled" 
              ScrollViewer.HorizontalScrollBarVisibility="Disabled"
              ActualItemsSource="{Binding Source={x:Static ClientManager:ServiceProvider.ViewManager}, Path=NewsFeed}"
              BorderThickness="0"
              Margin="0,0,0,0" Background="Transparent"
              ItemTemplate="{DynamicResource NewsFeedItemTemplate}" MaxWidth="800">
                        <ListBox.ItemContainerStyle>
                            <Style TargetType="ListBoxItem">
                                <Setter Property="FocusVisualStyle" Value="{x:Null}" />
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="ListBoxItem">
                                            <ContentPresenter />
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </ListBox.ItemContainerStyle>
                    </FacebookClient:IncrementalLoadListBox>
                </FacebookClient:DelayedResizeDecorator>
            </FacebookClient:ScaleScrollViewer>
            <StackPanel Grid.Column="1" Orientation="Horizontal" Panel.ZIndex="3" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,0,35,0" Opacity=".9" >
                <Button Command="FacebookClient:ScaleScrollViewer.ZoomOutCommand" 
                  CommandTarget="{Binding ElementName=ScaleScrollViewer}"  
                  AutomationProperties.AutomationId="ZoomOut" 
                  ToolTip="Zoom out"
                  Style="{DynamicResource ZoomInOutButtons}" 
                  Height="22" Width="22" Margin="0,9,0,0">
                    <Rectangle Margin="2" Height="18" Width="18"  Fill="{DynamicResource ZoomOutDrawingBrush}"/>
                </Button>
                <Button Command="FacebookClient:ScaleScrollViewer.ZoomInCommand" 
                  CommandTarget="{Binding ElementName=ScaleScrollViewer}" 
                  AutomationProperties.AutomationId="ZoomIn" 
                  ToolTip="Zoom in"
                  Style="{DynamicResource ZoomInOutButtons}"
                  Height="22" Width="22" Margin="5,9,0,0" >
                    <Rectangle Margin="2" Height="18" Width="18"  Fill="{DynamicResource ZoomInDrawingBrush}"/>
                </Button>
            </StackPanel>
        </Grid>
    </DataTemplate>

</ClientManagerView:EventResourceDictionary>
